package com.laery0.xixin.controller;


import com.laery0.xixin.po.Hospital;
import com.laery0.xixin.po.ResponseBean;
import com.laery0.xixin.service.HospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/api/hospital")
public class HospitalController {
    @Autowired
	private HospitalService hospitalService;

    @PostMapping("/")
	public ResponseBean<List<Hospital>> listHospital(@RequestBody Hospital hospital) {
		return hospitalService.listHospital(hospital.getState());
	}

    @PostMapping("/id")
	public ResponseBean<Hospital> getHospitalById(@RequestBody Hospital hospital) {
		return hospitalService.getHospitalById(hospital.getHpId());
	}
}
